home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / dviware / dviapollo / genwindow.h < prev    next >
C/C++ Source or Header  |  1990-10-01  |  2KB  |  64 lines

  1. #include <stdio.h>
  2. #define  RESOLUTION 118 /* This is pixels per inch. */
  3. /* DVIW's have the following state information:*/
  4.   struct dviw {
  5.     char *filename; /* Name of the file being displayed. */
  6.     int modtime; /* Last modification date of the file. */
  7.     FILE *dvifp; /* DVI file pointer */
  8.     long cpagep; /* Pointer to start of current page in the file */
  9.     long ppagep; /* Pointer to previous page in the file */
  10.     int pagenum; /* Number of the last page displayed, counting from 1. */
  11.     int pages;   /* Total number of pages in the file. */
  12.   };
  13.  
  14. typedef struct dviw *DVIW; 
  15. #define NEWDVIW (DVIW)malloc (sizeof (struct dviw))
  16.  
  17. /*
  18. A DVI window will have the following operations:
  19.  
  20. OpenDvi: Filename -> DVIW or NULL
  21.    Opens a dvi window viewing a particular file.*/
  22. DVIW OpenDvi ();
  23. /*CloseDvi: DVIW -> .
  24.    Closes a dvi window.  The text on the window is unaffected.  */
  25. void CloseDvi ();
  26. /*ReOpenDvi: DVIW X Filename -> DVIW
  27.    Equivalent to:
  28.    DVIW ReOpenDvi (olddvi, filename)
  29.         DVIW olddvi;
  30.     char *filename;
  31.    {
  32.       DVIW newdvi;
  33.       int safepages;
  34.       newdvi = OpenDvi (filename);
  35.       if (newdvi == NULL) {
  36.          CloseDvi (olddvi);
  37.      return (newdvi);
  38.       } else {
  39.          return (olddvi);
  40.       }
  41.    }
  42.    except that the above isn't quite legal because we forbid having 
  43.    multiple DVIW's open at once.*/
  44. DVIW ReOpenDvi ();
  45. /*ShowDviPage: DVIW X pagenum X xscroll X yscroll -> realpage
  46.    Attempts to show page pagenum of the file associated with DVIW.
  47.    Realpage will be different from pagenum if pagenum is not positive
  48.    or the document does not have that many pages.*/
  49. int ShowDviPage ();
  50. /*Pages: DVIW -> pagecount
  51.    Returns the total number of pages in an open DVIW.*/
  52. int Pages ();
  53.  
  54. /* For now, we will forbid having several of these open for one process
  55. at once.  However, it should be possible to open and close several
  56. DVIW's in sequence without accumulating garbage in the address space.
  57. (Unfortunately, this isn't true yet.) 
  58. /* The routines used to display the file will be determined at load time.
  59. Errors will be reported by calling showerror with the appropriate
  60. string.  The window manipulating routines don't take the window as
  61. argument, so the DVIW's don't have the windows as part of the state.
  62. */
  63.  
  64.